package com.baseweb.webadmin.core.constants;

import java.util.ArrayList;
import java.util.List;

public enum ArticleType {
    KNOWLEDGE(1,"婚礼知识"),HELP(2,"新手指导"),COLLEGE(3,"婚礼学院");

    private int code;
    private String name;
    ArticleType(int code, String name){
        this.code = code;
        this.name = name;
    }

    public int getCode() {
        return code;
    }

    public String getName() {
        return name;
    }

    public static List<ArticleType> getAllData(){
        List<ArticleType> result = new ArrayList<ArticleType>();
        for (ArticleType current : ArticleType.values())
        {
            result.add(current);
        }
        return result;
    }
    public static ArticleType getNameByCode(int code){
        List<ArticleType> allData = getAllData();
        for (ArticleType status : allData){
            if (status.getCode() == code){
                return status;
            }
        }
        return null;
    }
    public static List<String> getTypeOpt(){
        List<String> list = new ArrayList<>();
        for (ArticleType current : ArticleType.values())
        {
            String string = current.getCode() +";"+ current.getName();
            list.add(string);
        }
        return list;
    }
//    public static void main(String[] args) {
//        for(ChannelType c : getAllChannel()){
//            System.out.print(c.getName());
//        }
//    }
}
